﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace ThreeByte.ActiveDeck.Config
{
    public class GraphicStore : ObservableCollection<GraphicResource>
    {

        public GraphicResource GetGraphicByName(string name) {
            return this.Where(p => p.Name == name).SingleOrDefault();
        }

        public void AddIfNotPresent(GraphicResource res) {
            bool found = false;
            foreach(GraphicResource r in this) {
                if(r.ID == res.ID) {
                    found = true;
                    break;
                }
            }
            if(!found) {
                this.Add(res);
            }
        }
    }
}
